<template>
	<view class="mainpadding dingwei beijingse" v-if="pageShow">
		<view class="hongmb"></view>
		<view class="mainpadding ffffff radius dingwei">
			<view class="tixbtn" @click="jumper('/pages_mine/tixian?type=1')">去提现</view>
			<view class="ershiba xiaohei textcenter">总金额 (元）</view>
			<view class=" xiaohei margin_top2 textcenter" style="font-size: 52rpx;">{{userinfo.yj_money}}</view>
			<view class="flexbetween margin_top6">
				<view class="sanshis flexcenter">
					<view class="flexcolumn">
						<view class="xiaohui ershiba fonweight">可提现</view>
						<view class="xiaohui ershiba nofonweight margin_top1">{{Number(userinfo.yj_money)}}元</view>
					</view>
				</view>
				<view class="sanshis flexcenter">
					<view class="flexcolumn">
						<view class="xiaohui ershiba fonweight">今日收益</view>
						<view class="xiaohui ershiba nofonweight margin_top1">{{Number(userinfo.totay_sy)}}元</view>
					</view>
				</view>
				<view class="sanshis flexcenter">
					<view class="flexcolumn">
						<view class="xiaohui ershiba fonweight">已提现</view>
						<view class="xiaohui ershiba nofonweight margin_top1">{{userinfo.withdrawal_price}}元</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 我的邀请 -->
		<view class="margin_top">
			<view class="mainpadding ffffff radius flexbetween">
				<view class="wushi flexcenter" @click="jumper('/pages_index/wodeyaoqing')">
					<view class="">
						<view class="yaoqicon">
							<image src="../static/image/system/yqhy.png" mode=""></image>
						</view>
						<view class="xiaohei ershiba nofonweight margin_top1">我的邀请</view>
					</view>
				</view>
				<view class="wushi flexcenter" @click="jumper('/pages_mine/chuzhimingx?type=2')">
					<view class="">
						<view class="yaoqicon1">
							<image src="../static/image/system/txmx.png" mode=""></image>
						</view>
						<view class="xiaohei ershiba nofonweight margin_top1">提现明细</view>
					</view>
				</view>
			</view>
			<view class="xiaohui ershiba nofonweight margin_top textcenter">近7日邀请记录</view>
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 100rpx;"></view>
			</view>
			<view class="mainpadding ffffff radius margin_top flexbetween" v-for="item in list.data" :key="item.id">
				<view class="flexleft">
					<image class="touxiang margin_right2" :src="item.lyuserinfo.avatar_text" mode=""></image>
					<view class="">
						<view class="ershiba xiaohei fonweight">{{item.memo}}</view>
						<view class="strongtext xiaohui nofonweight margin_top1">{{item.createtime_text}}</view>
					</view>
				</view>
				<view class="flexright">
					<view class="xiaohong sanshier">{{item.money}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				pageShow:false,
				userinfo: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.getinfo()
			this.init()
		},
		methods: {
			init(isPage, page) { //提现记录
				let _this = this;
				let url = '/api/user/getUserYjMoneyLog'
				httpRequest.request(url, 'GET', {
					page: page || 1,
					limit: _this.limit,
					type: 0,
					ly: 1,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			getinfo() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userinfo = res.data
					this.pageShow = true
				})
			},
			// 跳转去提现
			jumper(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.touxiang {
		width: 96rpx;
		height: 96rpx;
		border-radius: 50%;

		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}

	.yaoqicon1 {
		margin: auto;
		width: 61rpx;
		height: 70rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.yaoqicon {
		margin: auto;
		width: 70rpx;
		height: 70rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.tixbtn {
		position: absolute;
		top: 30rpx;
		right: 30rpx;
		width: 150rpx;
		height: 58rpx;
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		font-size: 24rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: 300;
		color: #EE712F;
		border: 1rpx solid #EE7839;
	}

	.hongmb {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 0;
		width: 750rpx;
		height: 250rpx;
		background: linear-gradient(179deg, #FED6D0 0%, #FFE8E6 100%);
	}
</style>